/**
 * 高级类型
 * 联合类型：允许一个值可以是几种类型之一。
 * 交叉类型：允许一个值同时具有多个类型。
 * 类型别名：为类型起别名。
 */

class Person{
    name: string;
    constructor(name:string){
        this.name = name;
    }
}
let union: string|number = "Hello";
union = 123;

let intersection: Person & {age: number} = {name:"John",age:30}

type StringOrNumber = string|number;
let alias: StringOrNumber = "hello";
alias = 123;